package com.dvd.common;
import java.util.List;

import com.dvd.dao.usr.*;
import org.hibernate.*;
public class CommonModel {
	public TUsr searchAdminNm(String id)
	{
		TUsr usr =null;
		TUsrDAO dao = new TUsrDAO();
		Transaction tran = dao.getSession().beginTransaction();
		
		usr=dao.findById(id);
		
		tran.commit();
		dao.getSession().close();
		return usr;
	}
	
	public TUsr searchAdminNm()
	{
		TUsrDAO dao = new TUsrDAO();
		Transaction tran = dao.getSession().beginTransaction();
		List<TUsr> list=(List<TUsr>)dao.getSession().createCriteria(TUsr.class).list();
		tran.commit();
		dao.getSession().close();
		if(list.isEmpty())
		{
			return null;
		}
		else
		{
			return (TUsr)list.get(0);
		}
	}
}
